package com.wind.vo;

import com.baomidou.mybatisplus.plugins.Page;

/**
 * 统一返回结果静态类
 * @author Administrator
 *
 */
public class ResultDataGenerator {
	
	public static <T> ResultData<T> genSuccessResult(T data,String msg) {
		ResultData<T> result = new ResultData<T>();
		result.setData(data);
		result.setcode("200");
		result.setMsg(msg);
		return result;
	}
	
	public static <T> ResultData<T> genSuccessResult(T data, Page<?> page, String msg) {
		ResultData<T> result = new ResultData<T>();
		result.setData(data);
		result.setcode("200");
		result.setMsg(msg);
		result.setPage(page);
		return result;
	}

	public static <T> ResultData<T> genExceptionResult(T data, String msg) {
		ResultData<T> result = new ResultData<T>();
		result.setData(data);
		result.setcode("500");
		result.setMsg(msg);
		return result;
	}
	
	public static <T> ResultData<T> genFailResult(T data, String msg) {
		ResultData<T> result = new ResultData<T>();
		result.setData(data);
		result.setcode("301");
		result.setMsg(msg);
		return result;
	}
}
